# main.py

# 导入模块
from fetch_html import fetch_html
from parse_movie_title import parse_movie_title
from parse_director_actors import parse_director_actors
from fetch_extra_info import parse_movie_extra_info
from download_image import download_image

def main():
    url = "http://127.0.0.1:5000/"
    soup = fetch_html(url)
    
    if soup:
        # 1️⃣ 电影名称
        mTitle, mNative, mNickname = parse_movie_title(soup)
        print("电影名称:", mTitle)
        print("原名:", mNative)
        print("别名:", mNickname)
        print("------")

        # 2️⃣ 导演与主演
        mDirectors, mActors = parse_director_actors(soup)
        print("导演:", mDirectors)
        print("主演:", mActors)
        print("------")

        # 3️⃣ 其他信息
        mTime, mCountry, mType, mComments = parse_movie_extra_info(soup)
        print("时间:", mTime)
        print("国家:", mCountry)
        print("类型:", mType)
        print("评价:", mComments)
        print("------")

        # 4️⃣ 下载图片
        download_image(soup, url)

if __name__ == "__main__":
    main()
